<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <canvas id="canvas" width="400" height="400">
        此浏览器不支持canvas
    </canvas>
</body>
</html>
<script>
    const ctx = document.getElementById('canvas')
    const c = ctx.getContext('2d')
    // 绘制矩形，默认黑色
    c.fillStyle='red' // 设置红色
    c.fillRect(10,10,100,100)

</script>